package com.audaque.springboot.foshanupload.web.kafkademo.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.springframework.context.annotation.Bean;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.listener.ConsumerAwareListenerErrorHandler;
import org.springframework.kafka.listener.ListenerExecutionFailedException;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @author zgb
 * @desc 模拟消费时抛异常
 * @date 2023-04-17 16:34:49
 */
@Slf4j
@Component
public class ErrorListener {


    @KafkaListener(id = "err", topics = "topic.quick.error", errorHandler = "consumerAwareErrorHandler")
    public void errorListener(String data) {
        log.debug("topic.quick.error  receive : " + data);
        throw new RuntimeException("fail");
    }


}
